<?php
namespace Admin\Model;
use Think\Model;

class DepartureCityModel extends Model
{
    /* 自动验证规则 */
    protected $_validate = array(
        array('city_id', 'require', '城市必须', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('sort', 'number', '排序必须是数字', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
    );
    
    public function getAllDepartureCityList()
    {
		$list = $this->field('D.*, R.region_name')
                ->table('yiyou_departure_city D')
                ->join('LEFT JOIN yiyou_region R ON D.city_id = R.id')
                ->order('is_default desc, sort asc')
                ->select();
        return $list;
    }
}